package cn.czg.cms.mapper;

import org.apache.ibatis.annotations.*;

@Mapper
public interface UserFollowMapper {

    @Insert("INSERT IGNORE INTO user_follow (user_id, follow_user_id) VALUES (#{userId}, #{followUserId})")
    void insertFollow(@Param("userId") Long userId, @Param("followUserId") Long followUserId);

    @Delete("DELETE FROM user_follow WHERE user_id = #{userId} AND follow_user_id = #{followUserId}")
    void deleteFollow(@Param("userId") Long userId, @Param("followUserId") Long followUserId);

    @Select("SELECT COUNT(*) FROM user_follow WHERE user_id = #{userId} AND follow_user_id = #{followUserId}")
    int countFollow(@Param("userId") Long userId, @Param("followUserId") Long followUserId);
}
